package cn.hr.services.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.hr.dao.CommonDao;
import cn.hr.entity.Article;
import cn.hr.services.IArticleService;
import cn.hr.services.ICatalogService;
import cn.hr.vo.PageAttribute;

/**                                        
 * Description		文章服务类             
 * @author			郑澍璋                
 * @version			1.0                     
 * create Date		Apr 26, 2010
 */ 
@Service("articleService")
public class ArticleServiceImpl implements IArticleService {

	//公共数据访问类
	@Resource(name="commonDao")
	private CommonDao commonDao;
	//文章栏目服务类
	private ICatalogService catalogService;
	
	/**
	 * Description		增加文章		
	 * @param article	文章实体类
	 * @return			是否成功
	 * @author			郑澍璋 
	 * Create Date		Apr 26, 2010
	 */
	public boolean addArticle(Article article) {
		boolean flag = false;
		try{
			commonDao.save(article);
			flag = true;
		}catch(Exception e) {
			e.printStackTrace();
		}
		return flag;
	}

	public boolean deleteArticleByID(Long articleID) {
		boolean flag = false;
		try{
			commonDao.delete(Article.class, articleID);
		}catch(Exception e) {
			e.printStackTrace();
		}
		return flag;
	}

	public PageAttribute getArticleByCatalogID(int catalogID, int size, int page) {
		// TODO Auto-generated method stub
		return null;
	}

	public Article getArticleByID(Long articleID) {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean modefyArticle(Article article) {
		// TODO Auto-generated method stub
		return false;
	}
	
	public CommonDao getCommonDao() {
		return commonDao;
	}

	public void setCommonDao(CommonDao commonDao) {
		this.commonDao = commonDao;
	}

	public ICatalogService getCatalogService() {
		return catalogService;
	}

	public void setCatalogService(ICatalogService catalogService) {
		this.catalogService = catalogService;
	}

	public boolean addArticle(Article article, int catalogID, int userID) {
		// TODO Auto-generated method stub
		return false;
	}

}
